class Solution {
    string hash[10]={"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    string path;
    vector<string> ret;
    
public:
    vector<string> letterCombinations(string digits) {
        if(digits.size() == 0)
            return ret;
 
        dfs(digits, 0);
        return ret;
    }
 
    void dfs(const string& digits, int pos)
    {
        if(pos == digits.size())
        {
            ret.push_back(path);
            return;
        }
 
        for(auto ch : hash[digits[pos] - '0']) // 遍历数组里的字符串
        {
            path.push_back(ch);
            dfs(digits, pos + 1);
            path.pop_back(); // 恢复现场
        }
    }
};